<template>
  <a-table :columns="columns" :data-source="powerList" rowKey="id">
    <span slot="level" slot-scope="level">
      <a-tag color="#2db7f5" v-if="level==='0'"> 一级权限 </a-tag>
      <a-tag color="#87d068" v-else-if="level==='1'"> 二级权限 </a-tag>
      <a-tag color="#108ee9" v-else> 三级权限</a-tag>
      </span>
  </a-table>
</template>
<script>
import {columns} from '@/utils/powertablecolumns'
import { mapState } from "vuex";

export default {
  data() {
    return {
      columns,
    };
  },
  computed: {
    ...mapState({
      powerList: (state) => state.power.powerList || [],
    }),
  },
  mounted() {
    this.getPowerList();
  },
  methods: {
    getPowerList() {
      this.$store.dispatch("getPowerList");
    },
  },
};
</script>
